﻿<UserControl x:Class="ViewDashboardZoneOptions"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:OMANE.Modules.Dashboarding"
             mc:Ignorable="d" 
             xml:lang="fr-FR"
             d:DesignHeight="500" d:DesignWidth="300">

    <UserControl.Resources>

        <local:IntToEnumConverter x:Key="IntToEnumConverter" />

        <Style TargetType="{x:Type TabItem}">
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
            <Setter Property="Background" Value="White" />

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
                            <ContentPresenter Margin="3" x:Name="Content" ContentSource="Header" HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter Property="Panel.ZIndex" Value="1"/>
                                <Setter Property="Background" Value="Black"/>
                                <Setter Property="Foreground" Value="White"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type TabControl}">
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabControl}">
                        <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="ColumnDefinition0"/>
                                <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                                <RowDefinition x:Name="RowDefinition1" Height="*"/>
                            </Grid.RowDefinitions>
                            <UniformGrid Rows="1"  x:Name="HeaderPanel" Grid.Column="0" IsItemsHost="true" Margin="2,2,2,0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
                            <Border x:Name="ContentPanel" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
                                <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ContextMenu x:Key="OptionButtonContextMenu">
            <MenuItem Header="Initialiser" Click="InitialiserContextMenuItemClick" />
            <Separator />
            <MenuItem Header="Creer Ressource" Click="CreerRessourceContextMenuItemClick" />
            <MenuItem Header="Modifier Ressource" Click="ModifierRessourceContextMenuItemClick" />
            <MenuItem Header="Appliquer Ressource" Click="AppliquerRessourceContextMenuItemClick" />
            <Separator />
            <!--<MenuItem    DataContext="{Binding}" Header="Lier aux Donnees" Click="DataBindMenuItemClick" />-->
            <MenuItem Header="Lier a une Zone" />
        </ContextMenu>
    </UserControl.Resources>
    <Grid>
        <TabControl >
            <TabItem Header="Positionnement" >
                <Grid>
                    <Grid.RowDefinitions >
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                
                    <UniformGrid Columns="2" >
                        <Button Name="CreerStyleButton" Margin="5" Focusable="False" Content="Creer un style" Click="CreerStyleButtonClick" />
                        <Button Name="AppliquerStyleButton" Margin="5"  Focusable="False" Content="Appliquer un style" Click="AppliquerStyleButtonClick" />
                    </UniformGrid>    
                    
                    <ContentControl Foreground="Black" Grid.Row="1" >
                        <Grid  >
                            <Grid.RowDefinitions >
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions >
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="Largeur" Margin="3" VerticalAlignment="Center" Grid.Row="0" />
                            <TextBox VerticalAlignment="Center" Margin="3"  BorderBrush="Black" Grid.Column="1" Text="{Binding Path=Width, Mode=TwoWay, StringFormat=N0}"/>
                            <Button DataContext="Width" ContextMenu="{DynamicResource OptionButtonContextMenu}" Click="EditPropertyButtonClick" Grid.Column="2" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Hauteur" Margin="3" VerticalAlignment="Center" Grid.Row="1" />
                            <TextBox VerticalAlignment="Center" Margin="3" Grid.Row="1" BorderBrush="Black" Grid.Column="1"  Text="{Binding Path=Height, Mode=TwoWay, StringFormat=N0}"/>
                            <Button DataContext="Height"  ContextMenu="{DynamicResource OptionButtonContextMenu}" Click="EditPropertyButtonClick"  Grid.Column="2" Grid.Row="1" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Marge Haut" Margin="3" VerticalAlignment="Center" Grid.Row="2" />
                            <TextBox VerticalAlignment="Center" Margin="3" Grid.Row="2" BorderBrush="Black" Grid.Column="1" Text="{Binding Path=MarginTop, Mode=TwoWay, StringFormat=N0}" />
                            <Button DataContext="MarginTop"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick" Grid.Column="2" Grid.Row="2" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Marge Bas" Margin="3" VerticalAlignment="Center" Grid.Row="3" />
                            <TextBox VerticalAlignment="Center" Margin="3" Grid.Row="3" BorderBrush="Black" Grid.Column="1" Text="{Binding Path=MarginBottom, Mode=TwoWay, StringFormat=N0}" />
                            <Button  DataContext="MarginBottom"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick" Grid.Column="2" Grid.Row="3" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Marge Gauche" Margin="3" VerticalAlignment="Center" Grid.Row="4" />
                            <TextBox VerticalAlignment="Center" Margin="3" Grid.Row="4" BorderBrush="Black" Grid.Column="1" Text="{Binding Path=MarginLeft, Mode=TwoWay, StringFormat=N0}" />
                            <Button DataContext="MarginLeft"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick" Grid.Column="2" Grid.Row="4" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Marge Droite" Margin="3" VerticalAlignment="Center" Grid.Row="5" />
                            <TextBox VerticalAlignment="Center" Margin="3" Grid.Row="5" BorderBrush="Black" Grid.Column="1" Text="{Binding Path=MarginRight, Mode=TwoWay, StringFormat=N0}" />
                            <Button  DataContext="MarginRight" ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick" Grid.Column="2" Grid.Row="5" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Alignement Horizontal" Margin="3" VerticalAlignment="Center" Grid.Row="6" />
                            <ComboBox  VerticalAlignment="Center" Margin="3" Grid.Row="6" BorderBrush="Black" Grid.Column="1"
                                   SelectedIndex="{Binding Path=HorizontalAlignment, Mode=TwoWay, Converter={StaticResource IntToEnumConverter}}" >
                                <ComboBoxItem Content="Gauche" />
                                <ComboBoxItem Content="Centre" />
                                <ComboBoxItem Content="Droite" />
                                <ComboBoxItem Content="Justifie" />
                            </ComboBox>
                            <Button DataContext="HorizontalAlignment"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick" Grid.Column="2" Grid.Row="6" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Alignement Vertical" Margin="3" VerticalAlignment="Center" Grid.Row="7" />
                            <ComboBox VerticalAlignment="Center" Margin="3" Grid.Row="7" BorderBrush="Black" Grid.Column="1"  
                                  SelectedIndex="{Binding Path=VerticalAlignment, Mode=TwoWay, Converter={StaticResource IntToEnumConverter}}">
                                <ComboBoxItem Content="Haut" />
                                <ComboBoxItem Content="Centre" />
                                <ComboBoxItem Content="Bas" />
                                <ComboBoxItem Content="Justifie" />
                            </ComboBox>
                            <Button  DataContext="VerticalAlignment"   ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick" Grid.Column="2" Grid.Row="7" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Arriere Plan" Margin="3" VerticalAlignment="Center" Grid.Row="8" />
                            <ComboBox SelectedItem="{Binding Path=ZoneBackground, Mode=TwoWay}" ItemsSource="{Binding StandardBrushes}" Focusable="False" Background="White" VerticalAlignment="Center" Margin="3" Grid.Row="8" BorderBrush="Black" Grid.Column="1"  >
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <Rectangle Width="20" Height="20" Margin="2" Fill="{Binding}" />
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>
                                <ComboBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <UniformGrid />
                                    </ItemsPanelTemplate>
                                </ComboBox.ItemsPanel>
                            </ComboBox>
                            <Button  DataContext="ZoneBackground"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick" Grid.Column="2" Grid.Row="8" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Bordure" Margin="3" VerticalAlignment="Center" Grid.Row="9" />
                            <ComboBox SelectedItem="{Binding Path=ZoneBorderBrush, Mode=TwoWay}" ItemsSource="{Binding StandardBrushes}" Focusable="False" Background="White" VerticalAlignment="Center" Margin="3" Grid.Row="9" BorderBrush="Black" Grid.Column="1"  >
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <Rectangle Width="20" Height="20" Margin="2" Fill="{Binding}" />
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>
                                <ComboBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <UniformGrid />
                                    </ItemsPanelTemplate>
                                </ComboBox.ItemsPanel>
                            </ComboBox>
                            <Button DataContext="ZoneBorderBrush" ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick"  Grid.Column="2" Grid.Row="9" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Epaisseur Bordure" Margin="3" VerticalAlignment="Center" Grid.Row="10" />
                            <TextBox Text="{Binding Mode=TwoWay, Path=ZoneBorderThickness}" VerticalAlignment="Center" Margin="3" Grid.Row="10" BorderBrush="Black" Grid.Column="1"  />
                            <Button  DataContext="ZoneBorderThickness"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick"  Grid.Column="2" Grid.Row="10" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Rayon Bordure" Margin="3" VerticalAlignment="Center" Grid.Row="11" />
                            <TextBox Text="{Binding Mode=TwoWay, Path=ZoneCornerRadius}" VerticalAlignment="Center" Margin="3" Grid.Row="11" BorderBrush="Black" Grid.Column="1"  />
                            <Button  DataContext="ZoneCornerRadius"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick"  Grid.Column="2" Grid.Row="11" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Bloque le positionnement" Margin="3" VerticalAlignment="Center" Grid.Row="12" />
                            <CheckBox IsChecked="{Binding Mode=TwoWay, Path=LayoutBlocked}" VerticalAlignment="Center" Margin="3" Grid.Row="12" BorderBrush="Black" Grid.Column="1" IsThreeState="False"   />

                            <TextBlock Text="Bloque le redimensionnement" Margin="3" VerticalAlignment="Center" Grid.Row="13" />
                            <CheckBox  Grid.Row="13" IsChecked="{Binding Mode=TwoWay, Path=ResizingBlocked}" VerticalAlignment="Center" Margin="3" BorderBrush="Black" Grid.Column="1" IsThreeState="False"   />

                            <TextBlock Text="Titre" Margin="3" VerticalAlignment="Center" Grid.Row="14" />
                            <TextBox Grid.Row="14" Text="{Binding Mode=TwoWay, Path=Title}" VerticalAlignment="Center" Margin="3"  BorderBrush="Black" Grid.Column="1"  />
                            <Button Visibility="Collapsed" Grid.Row="14" ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick"  Grid.Column="2" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Position Titre" Margin="3" VerticalAlignment="Center" Grid.Row="15" />
                            <ComboBox  Grid.Row="15"  ItemsSource="{x:Static local:ZoneTitlePositionValues.Items }" SelectedItem="{Binding Mode=TwoWay, Path=TitlePosition}" VerticalAlignment="Center" Margin="3" BorderBrush="Black" Grid.Column="1"  />
                            <Button  DataContext="TitlePosition"  Grid.Row="15"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick"  Grid.Column="2" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                            <TextBlock Text="Afficher le titre" Margin="3" VerticalAlignment="Center" Grid.Row="16" />
                            <CheckBox IsChecked="{Binding Mode=TwoWay, Path=TitleVisibility}" VerticalAlignment="Center" Margin="3" Grid.Row="16" BorderBrush="Black" Grid.Column="1" IsThreeState="False"   />

                            <TextBlock Text="Style du Titre" Margin="3" VerticalAlignment="Center" Grid.Row="17" />
                            <Button Grid.Row="17" Content="Modifier" VerticalAlignment="Center" Margin="3" BorderBrush="Black" Grid.Column="1" Click="Button_Click_3"  />
                            <Button  DataContext="TitlePosition"  Grid.Row="17"  ContextMenu="{DynamicResource OptionButtonContextMenu}"  Click="EditPropertyButtonClick"  Grid.Column="2" Background="White" Focusable="False" BorderBrush="Black" BorderThickness="1" Height="10" Width="10" VerticalAlignment="Center" HorizontalAlignment="Center" />

                        </Grid>
                    </ContentControl>
                </Grid>
            </TabItem>
            <TabItem Header="Donnees">
                <DockPanel>
                    <UniformGrid DockPanel.Dock="Top" Columns="3">
                        <Button Margin="5" Content="Tri" />
                        <Button Margin="5" Content="Filtre" />
                        <Button Margin="5" Content="Colonnes" />
                    </UniformGrid>
                        <DataGrid Name="ZoneDataGrid">
                    
                </DataGrid>
                </DockPanel>
               
            </TabItem>
            <TabItem Header="Details" >
                <local:ViewDashboardPropertyGrid x:Name="ZonePropertyGrid" />
            </TabItem>
        </TabControl>
    </Grid>
</UserControl>
